import { Component, OnInit } from '@angular/core';
import { NavParams } from 'ionic-angular';
import { TasksService } from '../../../tasks/tasks.service';
import { ApproveTaskResponse } from '../../../../app/app.service';

@Component({
    selector: 'approve-page',
    templateUrl: 'approve.html'
})
export class ApprovePage implements OnInit {

    taskId: number;

    constructor(private tasksService: TasksService, private navParams: NavParams) {
    }

    ngOnInit() {
        this.taskId = this.navParams.data.taskId;
    }

    approve() {
        this.tasksService.approveTask(`${this.taskId}`)
            .then((res: ApproveTaskResponse) => {

            });
    }

    reject() {
        this.tasksService.rejectTask(`${this.taskId}`)
            .then((res: ApproveTaskResponse) => {

            });
    }

}
